﻿@model IEnumerable<MovieModel>

@{
    if(TempData["Info"] != null){
        <script type="text/javascript">
            $(document).ready(function () {
                DisplayDialog('@(TempData["Info"].ToString())');
            });
        </script>
    }
}

@{
    if (Model != null && Model.Any())
    {
    <table class="highlightTr">
        <thead>
        <tr>
            <th>Title</th>
            <th>Video Quality</th>
            <th>Audio Quality</th>
            <th>Genre</th>
            <th>Position</th>
            <th style="text-align:center">Added</th>
            <th style="text-align:center">Action</th>
        </tr>
        </thead>
    
        @{
            int currIndex = 0;
        }
        <tbody>
        @foreach (MovieModel movie in Model)
        {
            string className = (currIndex % 2 == 0) ? "rowColor" : "alternateRowColor";
            currIndex++;
        
            <tr class="@className">
                <td>@movie.Title </td>
                <td>@movie.VideoQualitiesAsString</td>
                <td>@movie.AudioQualitiesAsString</td>
                <td>@movie.MovieGenreAsString</td>
                <td>@movie.Location</td>
                <td>@movie.CreatedAt</td>
                <td>
                    @Html.ActionLink("Edit", "Edit", "Movie", new { id = movie.Id }, null) |
                    @Html.ActionLink("Delete", "Delete", "Movie", new { id = movie.Id }, new { @class = "delete" })
                </td>
            </tr>
        }
         </tbody>
    </table>
    }
}
<div style="visibility:hidden" id="dialog" title="Confirm">Do you really want to delete this movie?</div>


